home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ada / c01lab4.zip / LRMRDR / LRM_CODE.ZIP / LRM.A < prev    next >
Text File  |  1992-05-29  |  61KB  |  1,714 lines

  1. --::::::::::
  2. --copyrite.ada
  3. --::::::::::
  4. -- ***********************************************************************
  5. -- ON-LINE Ada LANGUAGE REFERENCE MANUAL by Richard Conn
  6. --
  7. -- COPYRIGHT NOTICE
  8. -- Ada LRM Reader - Interactive Presentation of the Ada LRM
  9. -- Copyright (C) 1992    Richard Conn
  10. --
  11. -- This program is free software; you can redistribute it
  12. -- and/or modify it under the terms of the GNU General Public
  13. -- License Version 1 as published by the Free Software
  14. -- Foundation.
  15. --
  16. -- This program is distributed in the hope that it will be
  17. -- useful, but WITHOUT ANY WARRANTY; without even the implied
  18. -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  19. -- PURPOSE.  See the GNU General Public License for more
  20. -- details.  You should have received a copy of the GNU General
  21. -- Public License along with this program; if not, write to the
  22. -- Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
  23. -- 02139, USA.  See the ABOUT screens for further information,
  24. -- including information on how to contact the author.
  25. --::::::::::
  26. --command.ads
  27. --::::::::::
  28. -- ***********************************************************************
  29. -- ON-LINE Ada LANGUAGE REFERENCE MANUAL by Richard Conn
  30. with Citation_Definition;
  31. package Command_Dispatcher is
  32.  
  33.   function Convert_Citation (CitS : in STRING)
  34.     return Citation_Definition.CITATION_ID;
  35.   -- Convert the indicated string ("n.n.n" or "keyword") to CITATION_ID
  36.  
  37.   procedure View_Help;
  38.   -- View help citation and then Dispatch (Citation_Definition.USER_INPUT)
  39.  
  40.   procedure Dispatch (Current_Citation : in Citation_Definition.CITATION_ID);
  41.   -- Dispatch Current_Citation as first command and continue with
  42.   -- USER_INPUT until command is QUIT
  43.  
  44. end Command_Dispatcher;
  45. --::::::::::
  46. --display.ads
  47. --::::::::::
  48. -- ***********************************************************************
  49. -- ON-LINE Ada LANGUAGE REFERENCE MANUAL by Richard Conn
  50. with SYSDEP;
  51. with Citation_Definition;
  52. with DAF_Handler;
  53. with System;  -- standard Ada environment
  54. with Console; -- CS Parts
  55. package Screen_Display_Controller is
  56.  
  57.   type ERROR_MESSAGE_ID is (INVALID_COMMAND,
  58.                             CANNOT_ADVANCE, CANNOT_BACK,
  59.                             STACK_EMPTY, STACK_FULL,
  60.                             PRINT_LOG,
  61.                             TOO_MANY_SCREENS,
  62.                             SEARCH_STRING,
  63.                             DAF_NOT_FOUND,
  64.                             INTERNAL_DAF_NDFO_ERROR,
  65.                             INTERNAL_DAF_RE_ERROR,
  66.                             INTERNAL_DAF_SO_ERROR,
  67.                             INTERNAL_DAF_UE_ERROR,
  68.                             UNEXPECTED_ERROR);
  69.   -- Kinds of error messages which may be displayed
  70.  
  71.   type SCREEN_BUFFER is array (NATURAL'(1)..SYSDEP.Text_Line_Count) of
  72.     DAF_Handler.LINE;
  73.   -- Lines associated with a screen
  74.  
  75.   type SCREEN_BUFFER_POINTER is access SCREEN_BUFFER;
  76.   -- Pointer to a screen buffer so the full buffer does not have to be
  77.   -- passed
  78.  
  79.   subtype LINE_NUMBER is NATURAL
  80.     range NATURAL(Console.ROW_NUMBER'FIRST) ..
  81.           NATURAL(Console.ROW_NUMBER'LAST);
  82.   -- Valid line number from Console.ROW_NUMBER
  83.  
  84.   procedure Show_Text;
  85.   -- Clear screen and display the text area
  86.  
  87.   procedure Mark_Line (Number : in LINE_NUMBER);
  88.   -- Place a mark on the indicated line
  89.  
  90.   procedure Show_Prompt;
  91.   -- Display prompt on command line; if Search_String is null, do not
  92.   -- display it; clear error message if one is present after one call
  93.   -- to Show_Prompt
  94.  
  95.   procedure Show_Error (Item : in ERROR_MESSAGE_ID);
  96.   -- Display error message
  97.  
  98.   procedure Print_Log_File_Closed_Message;
  99.   -- Print the message that the indicated print log file is closed
  100.  
  101.   function Convert (SB_Address : in System.ADDRESS) return
  102.     SCREEN_BUFFER_POINTER;
  103.   -- Given the address of a screen buffer object, return a pointer to it
  104.  
  105.   function Citation_to_Display (CitX : in Citation_Definition.CITATION_ID)
  106.       return STRING;
  107.   -- Given a citation ID, return a string of the form "n.n.n" or "keyword"
  108.  
  109. end Screen_Display_Controller;
  110. --::::::::::
  111. --pcit.ads
  112. --::::::::::
  113. -- ***********************************************************************
  114. -- ON-LINE Ada LANGUAGE REFERENCE MANUAL by Richard Conn
  115. with SYSDEP;
  116. with Citation_Definition;
  117. with Screen_Display_Controller;
  118. package Primitive_Citation_Handler is
  119.  
  120.   subtype SEARCH_STRING is STRING (1..SYSDEP.Screen_String_Length);
  121.  
  122.   -- Statistics on current citation
  123.   type CITATION_STATISTICS is record
  124.     ID                      : Citation_Definition.CITATION_ID;
  125.     Current_Screen_Number   : NATURAL;
  126.     Total_Number_of_Screens : NATURAL;
  127.     Stack_Level             : NATURAL;
  128.     Search_Str              : SEARCH_STRING;
  129.     Search_Last             : NATURAL; -- index of last char in Search_Str
  130.     Search_May_Be_Continued : BOOLEAN;
  131.   end record;
  132.  
  133.   -- Status of a search request
  134.   type SEARCH_STATUS is record
  135.     Is_Found        : BOOLEAN;  -- TRUE if string was found
  136.     Found_on_Screen : NATURAL;  -- if found, screen string was found on
  137.     Found_on_Line   : NATURAL;  -- if found, line string was found on
  138.   end record;
  139.  
  140.   -- Exceptions:
  141.   SCREEN_COUNT_OVERFLOW : exception;
  142.     -- raised if number of screens exceeds SYSDEP.Max_Number_of_Screens
  143.     -- raised by Open_New_Citation
  144.  
  145.   function DAF_File_Name (ITEM : in Citation_Definition.CITATION_ID)
  146.       return STRING;
  147.   -- Return the name of the *.daf file associated with a given CITATION_ID
  148.  
  149.   procedure Open_New_Citation (ID : in Citation_Definition.CITATION_ID);
  150.   -- Open a new citation for processing, closing the old one if
  151.   -- necessary; set the current screen to the first screen;
  152.   -- build an array of information on the screens
  153.  
  154.   function Push return BOOLEAN;
  155.   -- Push the stack, returning TRUE if OK
  156.  
  157.   function Pop return BOOLEAN;
  158.   -- Pop the stack, returning TRUE if OK
  159.   -- Screen Buffer is loaded appropriately
  160.  
  161.   procedure Load_Screen_Buffer;
  162.   -- Load the screen buffer with the current screen
  163.  
  164.   function Next_Screen return BOOLEAN;
  165.   -- Advance to the next screen, returning TRUE if done;
  166.   -- if at last screen of current citation, advance to the first screen
  167.   -- of the next citation
  168.   -- Screen Buffer is loaded appropriately
  169.  
  170.   function Previous_Screen return BOOLEAN;
  171.   -- Back up to the previous screen, returning TRUE if done;
  172.   -- if at first screen of current citation, back up to last screen
  173.   -- of previous citation
  174.   -- Screen Buffer is loaded appropriately
  175.  
  176.   function Next_Citation return BOOLEAN;
  177.   -- Advance to the first screen of the next citation, returning TRUE
  178.   -- if done Screen Buffer is loaded appropriately
  179.  
  180.   function Previous_Citation return BOOLEAN;
  181.   -- Back up to the first screen of the previous citation, returning TRUE
  182.   -- if done
  183.   -- Screen Buffer is loaded appropriately
  184.  
  185.   function Search_First (Item : in STRING) return SEARCH_STATUS;
  186.   -- Search for the Item from the beginning of the citation;
  187.   -- if Item is an empty string, resume search for last item requested
  188.  
  189.   function Search_Next (Item : in STRING) return SEARCH_STATUS;
  190.   -- Resume search for Item from the next line in the citation;
  191.   -- if Item is an empty string, resume search for last item requested
  192.  
  193.   function Current_Citation return CITATION_STATISTICS;
  194.   -- Return the statistics on the current citation
  195.  
  196.   procedure Close_All_Open_Citations;
  197.   -- Close all open citation files
  198.  
  199.   procedure Suspend;
  200.   -- Suspend operation for Print_Log
  201.  
  202.   procedure Resume;
  203.   -- Resume operation for Print_Log
  204.  
  205.   function Access_Screen
  206.     return Screen_Display_Controller.SCREEN_BUFFER_POINTER;
  207.   -- Return the address of the screen for printing or displaying
  208.  
  209. end Primitive_Citation_Handler;
  210. --::::::::::
  211. --cithandl.ads
  212. --::::::::::
  213. -- ***********************************************************************
  214. -- ON-LINE Ada LANGUAGE REFERENCE MANUAL by Richard Conn
  215. with Citation_Definition;
  216. package Citation_Handler is
  217. -- Abstract state machine for selecting and working with a given citation
  218.  
  219.   procedure View_Citation